<template>
  <el-container class="home-container">
    <!-- 头部区域 -->
    <el-header>头部主题</el-header>
    <el-container>
      <!-- 左侧菜单栏区域 -->
      <el-aside width="200px">
        <el-menu
        :default-active="activePath"
        active-text-color="#7676F0"
        text-color="#fff"
        router>
          <el-menu-item :index="'/' + item.path" v-for="item in menulist" 
          :key="item.id" @click="saveNavState('/'+ item.path)">
            <i class="el-icon-menu"></i>
            <span slot="title">{{item.name}}</span>
          </el-menu-item>
        </el-menu>
      </el-aside>

      <!-- 右侧内容区域 -->
      <el-main>
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>

export default {
  name: 'home',
  data () {
    return {
      menulist: [{
          id: 1,
          name: '酒店分类',
          path: 'cat'
        },{
          id: 2,
          name: '酒店',
          path: 'hotel'
        },{
          id: 3,
          name: '系统管理',
          path: 'system'
        },{
          id: 4,
          name: '轮播图',
          path: 'picture'
        },{
          id: 5,
          name: '订单',
          path: 'order'
        },{
          id: 6,
          name: '意见反馈',
          path: 'opinion'
        },
      ],
      // 路由跳转的地址
      activePath: ''
    }
  },
  methods: {
    saveNavState(activePath) {
      this.activePath = activePath;
    }
  },
  created () {
    this.activePath = '/cat';
  }
}
</script>

<style scoped>
@import "../assets/css/body/home.scss"
</style>